import com.fasterxml.jackson.databind.ser.Serializers;
import org.junit.Test;

import java.io.UnsupportedEncodingException;
import java.util.Base64;

/**
 * @ClassName Jwt
 * @Description 测试
 * @Author Mr.L
 * @Date 20:35 2019/11/20
 * @Version 2.1
 **/
public class Jwt {

    @Test
    public void testEncoder() throws UnsupportedEncodingException {
        String msg = "www.itheima.com";
        //编码
        byte[] encoder = Base64.getEncoder().encode(msg.getBytes("UTF-8"));
        String encoderMsg = new String(encoder, "UTF-8");
        System.out.println("编码后 = " + encoderMsg);
        //解码
        byte[] decoder = Base64.getDecoder().decode(encoder);
        String decoderMsg = new String(decoder, "UTF-8");
        System.out.println("解码后 = " + decoderMsg);
    }
}
